import axios from 'axios'

import type {InternalAxiosRequestConfig,AxiosResponse} from "axios";

const service = axios.create({
    baseURL:"http://118.178.238.19:3001/admin"
})

service.interceptors.request.use((config:InternalAxiosRequestConfig)=>{

    // 从本地获取存储的token
    if(sessionStorage.getItem('token')) {
        config.headers.token = sessionStorage.getItem("token");
    }
    
    return config;
});

// 响应拦截器
service.interceptors.response.use((res:AxiosResponse)=>{


    return res;
});

export default service;